% Main program for phase screen generation by Zernike method
% Written by Benchu Lu; email:benchuul@163.com
% Taiyuan University of Technology
clear; close all; clc;

params.Num = 5; % number of phase screen
params.j_max = 64; % maximum n value for Zernike plyns
params.D = 2; % aperture diameter [m]
params.r0 = 0.10; % Fried parameter [m]
params.L0 = 10; % Outer-scale [m]
params.l0 = 0.01; % Inner-scale [m]
params.N = 128; % grid size per side for screen [pixels]

ph = ActionFun(params);

% 绘图，可视化
x = linspace(-params.D/2,params.D/2,params.N);
[x,y] = meshgrid(x,x);
figure;surf(x,y,ph(:,:,1)),shading interp;
h = colorbar; %h.Label.String = 'Phase(rad)';
set(get(h,'Title'),'string','Phase(rad)');
zlabel('Phase(rad)')
view([45,45])

